## displayMenu is defined in WEB-INF/classes/globalMacros.vm
#macro( menuItem $menu $level )
    
  ## set parentname
  #if ($menu.parentname) 
  		#set ($parentname = $menu.parentname)      
  #else
  		#set ($parentname = "")
  #end
  
  ## set name
  #if ($menu.name) 
  		#set ($name = $menu.name)
  #else
  		#set ($name = "")
  #end
  
  ## set title
  #set ($title = $displayer.getMessage($menu.title))
  
  ## set description
  #if ($menu.description) 
  		#set ($description = $menu.description)
  #else
  		#set ($description = "")
  #end
  
  ## set target
  #if ($menu.target) 
  		#set ($target = $menu.target) 
  	#else 
  		#set ($target = "mainFrame")
  #end
  
  ## set action
  #if ($menu.action) 
  		#set ($action = $menu.action)
  #else
  		#set ($action = "")
  #end
  
  ## set location
  #if ($menu.location) #set ($location = $menu.location) #else #set ($location = "")
  #end
  
  ## set behavior
  ##if ($menu.behavior) 
  		##set ($behavior = $menu.behavior) 
  	##else 
  		##set ($behavior = "")
  ##end
  
 ## set icon
  #if ($menu.icon) 
  		#set ($icon = $menu.icon) 
  	#else 
  		#set ($icon = "")
  #end
  
  ## set openIcon
  #if ($menu.openIcon) 
  		#set ($openIcon = $menu.openIcon) 
  	#else 
  		#set ($openIcon = "")
  #end
  
  #set ($node = $menu.name)
  #if ($level == 0)
    var $node = new WebFXTree('$title', '$location', '$description', '$target');
  #else
    var $node = new WebFXTreeItem('$title'#if($menu.url),'$!menu.url'#end);
    ${menu.parent.name}.add($node);
  #end
#end

#displayMenu($menu 0)

document.write($menu.name);
